package com.oauth.server.extend.ex;

import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @作者: 林江
 * @创建时间: 2024/1/12
 * @功能:
 */
@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = CustomOAuth2ExceptionJackson2Serializer.class)
public class CustomOAuth2Exception extends OAuth2Exception {

    private Integer status = 400;

    public CustomOAuth2Exception(String msg, Throwable t) {
        super(msg, t);
        status = ((OAuth2Exception)t).getHttpErrorCode();
    }

    public CustomOAuth2Exception(String msg) {
        super(msg);
    }

    @Override
    public int getHttpErrorCode() {
        return status;
    }
}
